const storage = {
  getItem (key) {
    const content = localStorage.getItem(key) ? JSON.parse(localStorage.getItem(key)) : null
    return content ? content.value : null
  },
  setItem (key, value) {
    const conten = {
      date: +new Date(),
      value
    }
    localStorage.setItem(key, JSON.stringify(conten))
  },
  removeItem (key) {
    localStorage.removeItem(key)
  },
  clear () {
    localStorage.clear()
  }
}

export default storage
